package coolapk.cj.cj.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import lombok.Builder;
import lombok.Data;
import org.hibernate.validator.constraints.Length;

import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.time.LocalDateTime;

/**
 * @author wenjunjun9
 * @created 2021-02-16 16:21
 * @description
 */
@Data
@Builder
@TableName("t_goods")
public class Goods implements Serializable {

    @JsonSerialize(using = ToStringSerializer.class)
    @TableId(type = IdType.ASSIGN_ID)
    private Long id;

    /**
     * 奖品名称
     */
    @NotEmpty(message = "奖品名称不能为空")
    @Length(max = 20, message = "名称最长20个字")
    private String name;

    /**
     * 奖品提供者
     */
    @NotEmpty(message = "奖品提供者不能为空")
    private String provider;

    /**
     * 商品添加时间
     */
    private LocalDateTime createTime;

    /**
     * 商品修改时间
     */
    private LocalDateTime modifiedTime;

    /**
     * 开奖的农历：正月初五
     */
//    @NotEmpty(message = "开奖的农历不能为空")
    private String lunar;

    /**
     * 商品开奖时间，2021-02-16 23:59:59
     */
    @NotNull(message = "商品开奖时间不能为空")
    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern="yyyy-MM-dd'T'HH:mm:ss")
    private LocalDateTime publishTime;

    /**
     * 中奖人，没开奖为空
     */
    private String winner;

    /**
     * 中奖时间
     */
    private LocalDateTime winnerTime;
}
